console.show();
var win = floaty.rawWindow(
    <vertical background='#00000000'>
        <canvas id="canvas" layout_weight="1">
        </canvas>
        <button id="runStop" style="Widget.AppCompat.Button.Colored" h="50" text="关闭获取坐标" />
        <horizontal h="50">
            <button id="ks" style="Widget.AppCompat.Button.Colored" h="50" text="快手" layout_weight="1"/>
            <button id="hs" style="Widget.AppCompat.Button.Colored" h="50" text="火山" layout_weight="1"/>
            <button id="dy" style="Widget.AppCompat.Button.Colored" h="50" text="抖音" layout_weight="1"/>
            <button id="sb" style="Widget.AppCompat.Button.Colored" h="50" text="刷宝" layout_weight="1"/>
        </horizontal>
    </vertical>
);
win.setSize(-1, -1);
win.setTouchable(true);
setInterval(() => {}, 100);
new canvasDraw(win.canvas);
var h = 1;
var w = 1;
win.runStop.on("click",function(){
    win.close();
});
win.ks.on("click",function(){
    launchApp("快手极速版");
    toastLog("快手极速版坐标:");
});
win.hs.on("click",function(){
    launchApp("火山极速版");
    toastLog("火山极速版坐标:");
});
win.dy.on("click",function(){
    launchApp("抖音极速版");
    toastLog("抖音极速版坐标:");
});
win.sb.on("click",function(){
    launchApp("刷宝短视频");
    toastLog("刷宝短视频坐标:");
});
function canvasDraw(canvasView) {
    canvasView.on("draw", function(canvas){
        var paint = new Paint;
        paint.setStrokeWidth(10);
        paint.setStyle(Paint.Style.FILL);
        paint.setTextSize(60);
        paint.setColor(colors.parseColor("#000000"));
        w = canvas.getWidth();
        h = canvas.getHeight();
        canvasView.setOnTouchListener(function(view, event) {
            switch (event.getAction()) {
                case event.ACTION_DOWN:
                    downX = parseInt(event.getX());
                    downY = parseInt(event.getY());
                    toastLog("down:(" + downX + "," + downY + ")");
                    return false;
                case event.ACTION_MOVE:
                    return true;
                case event.ACTION_UP:
                    return false;
            };
            return true;
        })
        canvas.drawColor(0);
    });
}